<script setup>

import { inject } from 'vue';
const props = defineProps({
    obj: Object,
    msg: String
})

const emit = defineEmits(['btnName'])

const provideInfo = inject('provideInfo')
const btnClick = () => {
    console.log('子组件按钮');
    
    emit('btnName','wangwu')
}
</script>
<template>
    <h4>我是子组件</h4>

    <p>{{props.obj.name}}</p>
    <p>{{props.msg}}</p>
    <button @click="btnClick">子组件按钮</button>
    <div>{{provideInfo}}</div>
</template>